<template>
	<div id="mailList">
		<div class="i_maxW">
			<div class="u_crumbs">
				<router-link to="/personal/index">个人中心</router-link>
				<strong>
					<router-link to="/personal/journal/index">
						<i>></i>
						我的日记
					</router-link>
				</strong>
				<strong><i>></i>日记详情</strong>
			</div>
			<!--  -->
			<div class="u_resource">
				<div class="j_details">
					<p class="j_detailsH" v-html="nameInput"></p>
					<div class="j_details_mp">
						<span v-html="create_time"></span>
						<span v-show="length">字数 {{ length }}</span>
						<!-- <span>阅读 {{ clicks }}</span> -->
					</div>
					<div ref="profile" class="j_details_txt" v-html="profile">
					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
export default {
	data() {
		return {
			profile: '',
			nameInput: '',
			create_time: '',
			clicks: 0,
			length: 0
		};
	},
	mounted() {
		this.getJournalDetail()
	},
	methods: {
		getJournalDetail() {

			let success = (res => {
				var data = res.data[0];
				if (this.$g.user_id != res.data[0].create_id && res.data[0].authority === 0) {
					this.$message.error('私密的东西，不允许查看哦~~');
					this.$router.back(-1)
					return
				}
				this.nameInput = data.name;
				this.profile = data.profile
				this.authority = data.authority.toString()
				this.create_time = data.create_time
				this.clicks = data.clicks;
				this.length = data.profile_length

			})
			this.$ajax({
				url: '/api/resource/journal',
				params: {
					id: this.$route.query.id,
					status: 1,
					authority: -1
				},
				func: { success: success }
			})
		}
	}
}
</script>